package com.itcam.phaseii.exception_;

public class NumberFormatException_ {
    public static void main(String[] args) {
        String name = "cammy";
        // 将String转成int
        int num = 0;//抛出NumberFormatException
        try {
            num = Integer.parseInt(name);
        } catch (NumberFormatException e) {
            System.out.println("出现异常的类型: " + e.getClass() + " " + e.getMessage());//输出异常信息
        }
        System.out.println(num);
    }
}
